﻿using System;
using System.ComponentModel;

namespace MECopter.Quadrocopter
{
    public class ControllValues : INotifyPropertyChanged
    {
        #region Fields
        //Speed
        public float Speed
        {
            get { return _speed; }
            set
            {
                if (value != _speed)
                {
                    _speed = value;
                    PropertyChangedEventArgs e = new PropertyChangedEventArgs("Speed");                    
                    OnPropertyChanged(e);
                }
            }
            
        }
        private float _speed = 0;

        //Yaw
        public float Yaw
         {
            get { return _yaw; }
            set
            {
                if (value != _yaw)
                {
                    _yaw = value;
                    PropertyChangedEventArgs e = new PropertyChangedEventArgs("Yaw");                    
                    OnPropertyChanged(e);
                }
            }
        }
        private float _yaw = 0;

        //Pitch
        public float Pitch
        {
            get { return _pitch; }
            set
            {
                if (value != _pitch)
                {
                    _pitch = value;
                    PropertyChangedEventArgs e = new PropertyChangedEventArgs("Pitch");                    
                    OnPropertyChanged(e);
                }
            }
        }
        private float _pitch = 0;

        //Roll
        public float Roll
        {
            get { return _roll; }
            set
            {
                if (value != _roll)
                {
                    _roll = value;
                    PropertyChangedEventArgs e = new PropertyChangedEventArgs("Roll");                    
                    OnPropertyChanged(e);
                }
            }
        }
        private float _roll;
        #endregion


        #region Constructor
        public ControllValues()
        {
        }
        #endregion

        #region Eventhandler
        protected void OnPropertyChanged(PropertyChangedEventArgs e)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
                handler(this, e);
        }

        public event PropertyChangedEventHandler PropertyChanged;
        #endregion
    }
}
